package Reeks5.VanRansbeeck.Kevin.View;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class CenteredFrame extends JFrame {
    public CenteredFrame() {
        this("Centered Frame");
    }
    public CenteredFrame(String titel) {
        this(titel, Toolkit.getDefaultToolkit().getScreenSize().width / 2, Toolkit.getDefaultToolkit().getScreenSize().height / 2);
    }
    public CenteredFrame(String titel, int w, int h) {
        setTitle(titel);
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                dispose();
            }
        });
        setSize(w,h);
        setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (w/2), (Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (h/ 2));
    }
}
